import {useState,useMemo} from 'react'
export default ()=>{
    const [first,setFirst]=useState(10)
    const [second,setSecond]=useState(20)
    const result=useMemo(()=>{
        return first+second
    },[first,second])
    return <>
        <div>第1个数:{first} <button onClick={()=>{setFirst(first+1)}}>+</button></div>
        <div>第2个数:{second} <button onClick={()=>{setSecond(second+1)}}>+</button></div>
        <div>结果:{result}</div>
    </>
}